package com.lagou.mapreduce;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

public class HomeworkReducer extends Reducer<HomeworkBean, NullWritable,HomeworkBean,NullWritable> {

    int sum = 1;

    @Override
    protected void reduce(HomeworkBean key, Iterable<NullWritable> values, Context context) throws IOException, InterruptedException {
       //遍历values
        for (NullWritable value : values) {
            key.setId(sum);
            sum+=1;
            context.write(key,value);
        }

    }
}
